<?php

namespace App\Console\Commands;

use App\Repository\Models\Menu;
use App\Repository\Models\Action;
use Illuminate\Console\Command;
use Illuminate\Routing\Router;
use Illuminate\Support\Arr;
use Illuminate\Routing\Route;
use Illuminate\Support\Str;


class RouteCommand extends Command 
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'route:list';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '打印路由列表';


    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $router = app('router');
        $routes = $router->getRoutes();
        $this->line("Method\tUri\t\tAs");
        foreach ($routes as $route) {
            $this->line("{$route['method']}\t{$route['uri']}\t\t".array_get($route,'action.as'));
        }
    }

}
